<?php
if(!isset($_SESSION))
{
	session_start();
}
include '../operations/connection.php';

$idemployee = $_REQUEST['idemployee'];
$newlang = $_REQUEST['newlang'];
$usname = $_REQUEST['usname'];
$page = $_REQUEST['page'];

if ($_REQUEST['newlang'] == "EN") {
	include "../value/value_en.php";
} else if($_REQUEST['newlang'] == "VN") {
	include "../value/value_vn.php";
}
else {
	include "../value/value_kr.php";
}

$datenow = date('Y-m-d',time());

$selectsalaryregByID = mysql_query("SELECT sas.employeeID,sas.basic_salary,sas.allowance_basic_salary,sas.allowance_c,sas.allowance_senior,
			sas.salary_insurance,sas.createDate,sas.user_create,sas.user_last_update,sas.time_last_update, emp.FullName,emp.EmployeeCode  
 			FROM sa_regulation_salary sas,employee emp
			WHERE emp.IDEmployee = sas.employeeID AND emp.State = 1 AND emp.IDEmployee = '$idemployee'");
$result = mysql_fetch_assoc($selectsalaryregByID);
?>

<form action="content_salary/process-action-regulation-salary.php"
	method="post">
	<input type="hidden" id="userlast" name= "userlast" value="<?=$usname?>">
	<input type="hidden" id="page" name="page" value="<?=$page?>">
	<input type="hidden" id="idemployee" name="idemployee" value="<?=$result[employeeID]?>"/>
	<table style="border-bottom: 1px dotted silver; padding: 10px 5px"
		width="100%">
		<tr>
			<td class="tdfirst"><?php echo $l_employeecode;?>:</td>
			<td><input type="text" name="idemployeecode" readonly="readonly"
				value="<?=$result[EmployeeCode]?>" id="idemployeecode"
				class="in_testfield" style="width: 516px; background: #eaeaea" /></td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_employee_name;?>:</td>
			<td><input type="text" onkeypress="return enterTable(event,this.id);"
				name="nameemployee" value="<?=$result[FullName]?>" id="nameemployee"
				class="in_testfield" style="width: 516px; background: #eaeaea" /></td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_basicsalary;?>:</td>
			<td><input type="text" value="<?=number_format($result[basic_salary])?>"
				onkeypress="return enterTable(event,this.id);"
				name="basicsalary" id="basicsalary" class="in_testfield" style="width: 516px" /></td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_allowancebasicsalary;?>:</td>
			<td><input type="text" value="<?=number_format($result[allowance_basic_salary])?>"
				onkeypress="return enterTable(event,this.id);"
				name="allowancebasicsalary" id="allowancebasicsalary"
				class="in_testfield" style="width: 516px" /></td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_allowanceC;?>:</td>
			<td><input type="text" value="<?=number_format($result[allowance_c])?>"
				onkeypress="return enterTable(event,this.id);" id="allowanceC"
				name="allowanceC" class="in_testfield" style="width: 516px" />
			</td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_allowanceSenior;?>:</td>
			<td><input type="text" value="<?=number_format($result[allowance_senior])?>"
				onkeypress="return enterTable(event,this.id);"
				name="allowance_senior" id="allowance_senior" class="in_testfield" style="width: 516px" />
			</td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_salaryforinsurance;?>:</td>
			<td><input type="text"
				value="<?=number_format($result[salary_insurance])?>"
				onkeypress="return enterTable(event,this.id);"
				name="insuranceSalary" id="insuranceSalary" class="in_testfield" style="width: 516px" />
			</td>
		</tr>

		<?php
		if ($result[user_create]==""){
			?>
		<tr>
			<td class="tdfirst"><?php echo $l_user_create;?>:</td>
			<td><input type="text" value="<?php echo $usname?>"
				onkeypress="return enterTable(event,this.id);" id="user_create"
				name="user_create" class="in_testfield"
				style="width: 516px; background: #eaeaea" readonly="readonly" />
			</td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_first_create;?>:</td>
			<td><input type="text" value="<?php echo $datenow?>"
				onkeypress="return enterTable(event,this.id);"
				id="first_create_update" name="first_create_update"
				class="in_testfield" style="width: 516px; background: #eaeaea"
				readonly="readonly" />
			</td>
		</tr>
		<?php }else{?>
		<tr>
			<td class="tdfirst"><?php echo $l_user_create;?>:</td>
			<td><input type="text" value="<?php echo $result[user_create]?>"
				onkeypress="return enterTable(event,this.id);" id="user_create"
				name="user_create" class="in_testfield"
				style="width: 516px; background: #eaeaea" readonly="readonly" />
			</td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_first_create;?>:</td>
			<td><input type="text" value="<?php echo $result[createDate]?>"
				onkeypress="return enterTable(event,this.id);"
				id="first_create_update" name="first_create_update"
				class="in_testfield" style="width: 516px; background: #eaeaea"
				readonly="readonly" />
			</td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_user_last_update;?>:</td>
			<td><input type="text" onkeypress="return enterTable(event,this.id);"
				value="<?php echo $result[user_last_update]?>" id="user_last_update"
				name="user_last_update" class="in_testfield"
				style="width: 516px; background: #eaeaea" readonly="readonly" />
			</td>
		</tr>
		<tr>
			<td class="tdfirst"><?php echo $l_time_last_update;?>:</td>
			<td><input type="text" onkeypress="return enterTable(event,this.id);"
				value="<?php echo $result[time_last_update]?>" id="time_last_update"
				name="time_last_update" class="in_testfield"
				style="width: 516px; background: #eaeaea" readonly="readonly" />
			</td>
		</tr>
		<?php }?>



	</table>

	<table style="border-bottom: 1px dotted silver; padding: 10px 5px"
		width="100%">
		<tr>
			<td class="tdfirst" style="background: none;"></td>
			<td style="padding-left: 45px">
			<?php if ($result[user_create]==""){?>
					<input id="createSalary" name="createSalary" style="margin-right: 3px; width: 100px; border: none;" 
					type="submit" value="<?php echo $l_create;?>" class="buttonNormal"/>
					<input id="Update" name="update" style="margin-right: 3px; width: 100px; border: none;visibility: hidden;display: none;" type="submit"
					value="<?php echo $l_update;?>" class="buttonNormal" /> 
			<?php }else {?> 
			<input id="createSalary" name="createSalary" style="margin-right: 3px; width: 100px; border: none;visibility: hidden;display: none;" type="submit"
					value="<?php echo $l_create;?>" class="buttonNormal" />
				<input id="Update" name="update" style="margin-right: 3px; width: 100px; border: none;" type="submit"
					value="<?php echo $l_update;?>" class="buttonNormal" /> 
			<?php }?>
				<input id="Reset" name="Reset" style="margin-right: 3px; width: 100px; border: none;" type="reset"
					value="<?php echo $l_reset;?>" class="buttonNormal"  onclick="resetChild()" />
			</td>
		</tr>
	</table>
</form>
